{% extends "AcmeLikipeBlogBundle::Common/layout.html.twig" %}


{% block title %}
 List comments of Post: {{ post.content }}
{% endblock %}

{% block content %}

{% if post.getComments()|length == 0 %}
<h1>No found Comment in Post with id {{ post.id }}</h1>
{% else %}

{% if app.session.hasFlash('notice') %}
<span style="color: red">{{ app.session.flash('notice') }}</span>
{% endif %}
<h1>List Comments</h1>

<table border="5">
	<tr>
		<th>STT</th>
		<th>ID</th>
		<th class="list_blogs">CONTENT</th>
		<th>CREATED</th>
		<th>AUTHOR</th>
		<th>ACTION</th>
	</tr>
	{% for key, comment in post.getComments() %}
	<tr>
		<td>{{ key + 1 }}</td>
		<td>{{ comment.id }}</td>
		<td>{{ comment.content }}</td>
		<td>{{ comment.created|date('d/m/y') }}</td>
		<td style="text-align: center;">{{ comment.author }}</td>
		<td style="text-align: center;">
			<a href="{{ path('AcmeLikipeBlogBundle_comment_delete', {'iId': comment.id}) }}" onclick="if (! confirm('You are sure to delete this Comment?')) return false;">
				<img style="width: 32px; heigth: 32px;" alt="Delete comment with id {{ comment.id }}" src="{{ asset('likipe/img/button_delete.png') }}">
			</a>
			<a href="{{ path('AcmeLikipeBlogBundle_comment_edit', {'iId': comment.id}) }}">
				<img style="width: 32px; heigth: 32px;" alt="Edit comment with id {{ comment.id }}" src="{{ asset('likipe/img/button_edit.png') }}">
			</a>
		</td>
	</tr>
	{% endfor %}
</table>

{% endif %}
<br /><br />
<a style="font-size: 20px; font-family: Brush Script Std;" href="{{ path('AcmeLikipeBlogBundle_comment_add', {'iId': post.id}) }}">Add new Comment</a>
<br /><br />
{% endblock %}


